package google.android.ageofempires;

import java.nio.FloatBuffer;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorMatrix;
import android.graphics.Paint;
import android.graphics.Bitmap.Config;
import android.util.FloatMath;

public class Artifact {
	
	public static Bitmap Transparency(Bitmap seed)
	{		
		int mWidth = seed.getWidth();
		int mHeight = seed.getHeight();
		int[] mArrayColor = new int[mWidth * mHeight];		
//		int mHole = 0;
//		int mX = 0, mY = 0;
		Bitmap mFullTree = Bitmap.createBitmap(mWidth, mHeight, Config.ARGB_8888);
		Canvas mFullTreeCanvas = new Canvas(mFullTree);
		
		try
		{
			int mColor = seed.getPixel(0, 0);						
			seed.getPixels(mArrayColor, 0, mWidth, 0, 0, mWidth, mHeight);					
			for(int i = 0; i < mArrayColor.length; i++) {
				if(mArrayColor[i] == mColor) {
					mArrayColor[i] = 0;
				}
			}			
			mFullTreeCanvas.drawBitmap(mArrayColor, 0, mWidth, 0, 0, mWidth, mHeight, true, null);
//			mFullTreeCanvas.drawBitmapMesh(seed, 20, 20, mVerts, 0, null, 0, null);
//			for(mY = 0; mY < mHeight; mY++)
//			{
//				for(mX = 0; mX < mWidth; mX++)
//				{
//					mHole = mY * mWidth + mX;
//					if(mArrayColor[mHole] == mColor)
//					{
//						mArrayColor[mHole] = 0x00;
//					}
//				}
//			}
			
//			mFullTree = Bitmap.createBitmap(mArrayColor, mWidth, mHeight, Bitmap.Config.ARGB_8888);			
		}
		catch(IllegalArgumentException e)
		{
			e.printStackTrace();
		}
		return mFullTree;
	}		
}
